//最优比率生成树
//二分(TLE):
const eps=1e-5;
var
    l,r,mid:extended;
    i,n:longint;
    d:array[0..1010]of extended;
    x,y,h:array[0..1010]of longint;
    b:array[0..1010]of boolean;
function cal(x1,x2,y1,y2:longint):extended;
begin
    exit(sqrt(sqr(x2-x1)+sqr(y2-y1)));
end;
function work(ans:extended):extended;
var i,j,maxi:longint; max:extended;
begin
    d[1]:=0; b[1]:=true; work:=0;
    for i:=2 to n do
        d[i]:=cal(x[i],x[1],y[i],y[1])-ans*abs(h[i]-h[1]);
    for i:=1 to n-1 do
        begin
            max:=-1e10; maxi:=0;
            for j:=2 to n do
                if not(b[j])and(d[j]>max) then
                    begin
                        max:=d[j]; maxi:=j;
                    end;
            b[maxi]:=true; work:=work+d[maxi];
            for j:=2 to n do
                d[j]:=max(d[j],cal(x[j],x[maxi],y[j],y[maxi])-ans*abs(h[j]-h[maxi]));
        end;
end;
begin
    readln(n);
    while n<>0 do
        begin
            for i:=1 to n do readln(x[i],y[i],h[i]);
            l:=0; r:=1e10;
            while l+eps<r do
                begin
                    fillchar(b,sizeof(b),false);
                    mid:=(l+r)/2;
                    if work(mid)>0 then l:=mid else r:=mid;
                end;
            writeln(1/l:0:3);
            readln(n);
        end;
end.

Dinkelbach(AC):
const eps=1e-5;
var
    l,ans:extended;
    i,n:longint;
    a,c,d:array[0..1010]of extended;
    x,y,h:array[0..1010]of longint;
    b:array[0..1010]of boolean;
function cal(x1,x2,y1,y2:longint):extended;
begin
    exit(sqrt(sqr(x2-x1)+sqr(y2-y1)));
end;
function work(ans:extended):extended;
var i,j,mini:longint; min,p,q:extended;
begin
    d[1]:=0; b[1]:=true; work:=0; p:=0; q:=0;
    for i:=2 to n do
        begin
            a[i]:=abs(h[i]-h[1]);
            c[i]:=cal(x[i],x[1],y[i],y[1]);
            d[i]:=a[i]-ans*c[i];
        end;
    for i:=1 to n-1 do
        begin
            min:=1e10; mini:=0;
            for j:=2 to n do
                if not(b[j])and(d[j]<min) then
                    begin
                        min:=d[j]; mini:=j;
                    end;
            b[mini]:=true; p:=p+a[mini]; q:=q+c[mini];
            for j:=2 to n do
                begin
                    if abs(h[j]-h[mini])-ans*cal(x[j],x[mini],y[j],y[mini])<d[j] then
                    begin
                        a[j]:=abs(h[j]-h[mini]);
                        c[j]:=cal(x[j],x[mini],y[j],y[mini]);
                        d[j]:=a[j]-ans*c[j];
                    end;
                end;
        end;
    exit(p/q);
end;
begin
    readln(n);
    while n<>0 do
        begin
            for i:=1 to n do readln(x[i],y[i],h[i]);
            l:=0;
            repeat
                fillchar(a,sizeof(a),0);
                fillchar(b,sizeof(b),0);
                fillchar(c,sizeof(c),0);
                fillchar(d,sizeof(d),0);
                ans:=l; l:=work(ans);
            until abs(ans-l)<eps;
            writeln(ans:0:3);
            readln(n);
        end;
end.